import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns : BasicColumn[] = [
	{
		title: '创建日期',
		align: "center",
		dataIndex: 'createTime',
		customRender: ({ text }) => {
			return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
		},
	},
	{
		title: '景点等级',
		align: "center",
		dataIndex: 'scenicSpot_dictText'
	},
	{
		title: '所在城市',
		align: "center",
		dataIndex: 'cityId_dictText'
	},
	{
		title: '详细地址',
		align: "center",
		dataIndex: 'address'
	},
	{
		title: '景点名称',
		align: "center",
		dataIndex: 'title'
	},
	{
		title: '经纬度',
		align: "center",
		dataIndex: 'lotAndLat'
	},
	{
		title: '产品数量',
		align: "center",
		sorter: true,
		dataIndex: 'pdtNum'
	},
	{
		title: '总销售额',
		align: "center",
		sorter: true,
		dataIndex: 'salesTotal'
	},
	{
		title: '核销总额',
		align: "center",
		sorter: true,
		dataIndex: 'chargeOff'
	},
	{
		title: '未核销总额',
		align: "center",
		sorter: true,
		dataIndex: 'unchargeOff'
	},
	{
		title: '景点介绍',
		align: "center",
		dataIndex: 'msg'
	},
	{
		title: '核销员工数',
		align: "center",
		dataIndex: 'verificationNum'
	},
	{
		title: '全拼',
		align: "center",
		dataIndex: 'firstSpell'
	},
	{
		title: '租户',
		align: "center",
		dataIndex: 'tenantId'
	},
];
//查询数据
export const searchFormSchema : FormSchema[] = [
/* 	{
		label: "所在城市",
		field: 'shopType',
		component: 'JTreeDict',
		componentProps: { async: true, parentCode: 'A02' },
		//colProps: {span: 6},
	}, */
	{
	    label: "景点等级",
	    field: 'scenicSpot',
	    component: 'JSearchSelect',
	    componentProps:{
	       dict:"scenicSpot"
	    },
	    //colProps: {span: 6},
	},
	{
		label: "景点名称",
		field: 'title',
		component: 'Input',
		//colProps: {span: 6},
	},
];
//表单数据
export const formSchema : FormSchema[] = [

	{
		label: '景点名称',
		field: 'title',
		component: 'Input',
	},
	{
	    label: "景点等级",
	    field: 'scenicSpot',
	    component: 'JSearchSelect',
	    componentProps:{
	       dict:"scenicSpot"
	    },
	    //colProps: {span: 6},
	},
	{
		label: '所在城市',
		field: 'cityId',
		component: 'JTreeDict',
		componentProps: { async: true, parentCode: 'A02' },
	},
	
	{
		label: '经纬度',
		field: 'lotAndLat',
		component: 'Input',
		slot: 'lotAndLat'
	},
	{
		label: '详细地址',
		field: 'address',
		component: 'InputTextArea',
	},
	{
		label: '景点图片',
		field: 'imgs',
		component: 'JImageUpload',
		 helpMessage: '最多上传10张图片',
		componentProps: {
			fileMax:10
		},
	},
	{
		label: '景点介绍',
		field: 'msg',
		component: 'JEditor',
	},

	/* {
	  label: '产品数量',
	  field: 'pdtNum',
	  component: 'Input',
	  dynamicRules: ({model,schema}) => {
			return [
				   { required: false},
				   { pattern: /^-?\d+$/, message: '请输入整数!'},
			];
	   },
	},
	{
	  label: '核销用户数',
	  field: 'verificationNum',
	  component: 'InputNumber',
	}, */
	// TODO 主键隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData) : FormSchema[] {
	// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
	return formSchema;
}